package java流相关;

import java.io.*;

/**
 * @author coderFu
 * @create 2022/3/4
 * 缓冲流
 */
public class BufferStream {

    public static void main(String[] args) throws IOException {

        // 使用缓冲流来处理文件  字节缓冲流

        InputStream is = new BufferedInputStream(new FileInputStream("china.txt"));
        File file;
        OutputStream os = new BufferedOutputStream(new FileOutputStream("buffer.txt"));

        byte[] buffer = new byte[1024];

        int len ;
        while((len = is.read(buffer)) != -1){
            os.write(buffer,0,len);
        }
        is.close();
        os.close();
    }
}
